//
//  InviteResultViewController.m
//  leo
//
//  Created by 常艳 on 16/2/28.
//  Copyright © 2016年 mdx. All rights reserved.
//

#import "InviteResultViewController.h"
#import "Watch.h"
#import "DataManager.h"
@interface InviteResultViewController ()

@end

@implementation InviteResultViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.extendedLayoutIncludesOpaqueBars=YES;
    self.title=@"添加副管理员";
    UIBarButtonItem *leftButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"Back_icon@2x.png"] style:UIBarButtonItemStylePlain target:self action:@selector(back)];
    [self.navigationItem setLeftBarButtonItem:leftButton];
    if(self.type==1)
    {
        NSString *watchName=@"手表";
        DataManager *dataManager=[[DataManager alloc] init];
        User *user=[User sharedSingleton];
        if(user!=NULL&&user.uid!=NULL&&dataManager!=NULL)
        {
            Watch *selectWatch=[dataManager getActiveWatch:user.uid];
            if(selectWatch!=NULL)
                watchName=selectWatch.nickname;
        }
        self.infoLab.text=[NSString stringWithFormat:@"已添加%@成为%@的副管理员",self.nickName,watchName];
    }
    else
    {
        self.infoLab.text=@"该用户未注册，需要注册后才能邀请，已发送下载链接到该手机";
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/
- (IBAction)finish:(id)sender {
    NSArray * ctrlArray = self.navigationController.viewControllers;
    [self.navigationController popToViewController:[ctrlArray objectAtIndex:1] animated:YES];
}
-(void)back
{
    NSArray * ctrlArray = self.navigationController.viewControllers;
    [self.navigationController popToViewController:[ctrlArray objectAtIndex:1] animated:YES];
    
}
@end
